import {Base64} from '@/utils/xMessager/common/base64'
export function loadInitLine(serverUrl,roompara,flvSupport){
 	var urlArr = [];
	if(roompara && roompara.default_line){
	 	for(var i = 0; i < serverUrl.length; i++){
			if(serverUrl[i].id == roompara.default_line){
				var remove_arr = serverUrl.splice(i,1);
				serverUrl.splice(0,0,remove_arr[0]);
			}
		}
	}
	if(flvSupport){
		serverUrl.forEach((item,index)=>{
			if(item.flv && typeof(item.flv) === 'string'){
				item.flv = Base64.decode(item.flv)
				urlArr.push(item.flv)
			}
		})
	}else{
		serverUrl.forEach((item,index)=>{
			item.hls = Base64.decode(item.hls)
			urlArr.push(item.hls)
		})
	}
 	return {urlArr,serverUrl};
}